package com.cqc.byeburgerdemo01;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

/**
 * Created by ${cqc} on 2016/11/24.
 */

public class HolderFragment extends Fragment {

    private View rootView;
    private TextView tv;

    public static HolderFragment getInstance(String text) {
        HolderFragment fragment = new HolderFragment();
        Bundle bundle = new Bundle();
        bundle.putString("text", text);
        fragment.setArguments(bundle);
        return fragment;
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        rootView = inflater.inflate(R.layout.fragment_holder, container, false);
        tv = (TextView) rootView.findViewById(R.id.tv_frag_holder);
        tv.setText(getArguments().getString("text"));
        return rootView;
    }
}
